/**
 * 初始化病种入组病例详情对话框
 */
var SdsQcincaseInfoDlg = {
    validateFields: {
    	episodeId: {
            validators: {
                notEmpty: {
                    message: '就诊ID不能为空'
                }
            }
        },
    	entityId: {
            validators: {
                notEmpty: {
                    message: '病种指针不能为空'
                }
            }
        },
    	entityVerId: {
            validators: {
                notEmpty: {
                    message: '病种版本不能为空'
                }
            }
        },
    	inUserId: {
            validators: {
                notEmpty: {
                    message: '入单人ID不能为空'
                }
            }
        },
    	inLocId: {
            validators: {
                notEmpty: {
                    message: '入单科室ID不能为空'
                }
            }
        },
    	inWardId: {
            validators: {
                notEmpty: {
                    message: '入单病区ID不能为空'
                }
            }
        },
    	inDate: {
            validators: {
                notEmpty: {
                    message: '入单日期不能为空'
                }
            }
        },
    	inTime: {
            validators: {
                notEmpty: {
                    message: '入单时间不能为空'
                }
            }
        },
    	outDocId: {
            validators: {
                notEmpty: {
                    message: '出单人ID不能为空'
                }
            }
        },
    	outDate: {
            validators: {
                notEmpty: {
                    message: '出单日期不能为空'
                }
            }
        },
    	outTime: {
            validators: {
                notEmpty: {
                    message: '出单时间不能为空'
                }
            }
        },
    	state: {
            validators: {
                notEmpty: {
                    message: '当前状态不能为空'
                }
            }
        },
    	relativeCpId: {
            validators: {
                notEmpty: {
                    message: '关联路径记录不能为空'
                }
            }
        },
    }
};


/**
 * 关闭此对话框
 */
SdsQcincaseInfoDlg.close = function() {
    parent.layer.close(parent.layer.getFrameIndex(window.name)); //先得到当前iframe层的索引,再执行关闭   
}

/**
 * 验证数据是否为空
 */
SdsQcincaseInfoDlg.validate = function () {
    $('#sdsQcincaseInfoForm').data("bootstrapValidator").resetForm();
    $('#sdsQcincaseInfoForm').bootstrapValidator('validate');
    return $("#sdsQcincaseInfoForm").data('bootstrapValidator').isValid();
}

/**
 * 提交新增
 */
SdsQcincaseInfoDlg.addSubmit = function() {

    if (!this.validate()) {
        return;
    }
    //提交信息
    Sys.ajaxForm('sdsQcincaseInfoForm',Sys.backendPath + "/sds/sdsqcincase/add",function(res) {
        Sys.success(res.message);
    	window.parent.SdsQcincase.table.refresh();
        SdsQcincaseInfoDlg.close();
    });
}

/**
 * 提交修改
 */
SdsQcincaseInfoDlg.editSubmit = function() {

    if (!this.validate()) {
        return;
    }
    //提交信息
    Sys.ajaxForm('sdsQcincaseInfoForm',Sys.backendPath + "/sds/sdsqcincase/update",function(res) {
        Sys.success(res.message);
    	window.parent.SdsQcincase.table.refresh();
        SdsQcincaseInfoDlg.close();
    });
}

$(function() {
	Sys.initValidator("sdsQcincaseInfoForm", SdsQcincaseInfoDlg.validateFields);
});
